package com.example.swagger.util;

import org.springframework.util.StringUtils;
/**
 * 解析工具类
 */
public class AnalysisUtils {
    /**
     * 解析关系类型
     * @param relationType relationType
     * @return String
     */
    public static String getRelationType(String relationType) {
        StringBuilder typeSb = new StringBuilder();
        //1-服务关系;2-签约关系;10-开发关系(默认开发关系)
        String typeStr = null;
        if (!StringUtils.isEmpty(relationType)) {
            String[] types = relationType.split(";");
            for (String type: types) {
                if (!StringUtils.isEmpty(type)) {
                    switch (type) {
                        case "1":
                            typeSb.append("服务").append("|");
                            break;
                        case "2":
                            typeSb.append("签约").append("|");
                            break;
                        case "10":
                            typeSb.append("开发").append("|");
                            break;
                    }
                }
            }
            if (typeSb.length() > 0) {
                typeStr = typeSb.substring(0,typeSb.length() -1);
            }
        } else {
            typeStr = "开发";
        }
        return typeStr;
    }
}
